import java.util.*;

public class code1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        int h,a,H,A;
        while(t--!=0) {
            h = in.nextInt();
            a = in.nextInt();
            H = in.nextInt();
            A = in.nextInt();
            //特殊情况
            if(a>=H) System.out.println(-1);
            else {
                int HV = H;
                int count = 0;
                while(h>0) {
                    HV-=a;
                    if(HV<=0) {
                        count++;
                        HV = H;
                        continue;
                    }
                    h-=A;
                }
                System.out.println(count);
            }
        }

    }
}